//
//  WebConnection.h
//  Growth
//
//  Created by Hobo.Chen on 1/5/12.
//  Copyright 2012 MEETStudio. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "PublicDatabaseEngine.h"
#import "WebRequest.h"
#import "WebConnetionArray.h"
#import "CJSONSerializer.h"
#import "SDDataCache.h"

@protocol WebConnectionDelegate;

@interface WebConnection : NSObject {
	NSMutableData *jsonData;
    
    //做本地数据库缓存
    NSString *dataBaseListName;
    int diaryId;
    
    int  statusCode;
    
    
}

@property (assign) id<WebConnectionDelegate> connectionDelegate; 

@property (nonatomic, retain) NSMutableData *jsonData;

@property (nonatomic,retain)  NSString *dataBaseListName;

- (id)initWith:(NSMutableURLRequest *)request delegate:(id)delegate dataBaseListName:(NSString *)listName;

//上传离线记录
-(void)upTheLocalDiary;


//数据数据缓存

- (void) saveDataToDatabaseWithType:(NSString *)listType stringData:(NSString *)stringData;

@end


@protocol WebConnectionDelegate <NSObject>
@optional 

- (void)connectionSuccess:(NSDictionary *)dict;
- (void)connectionError:(NSError *)error;

- (void)postSuccess:(NSString *)postinfo;
@end